public class Test {
    public int func(String s){
        int[] count = new int[126];
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            count[ch]++;
        }

        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (count[ch] == 1) {
                return 1;
            }
        }
        return -1;
    }
    public static void main(String[] args) {

    }
    public static void main2(String[] args) {
        char[] ch = {'a','b','c'};
        String s1 = new String(ch);
        s1.intern();
        String s2 = "abc";
        System.out.println(s1 == s2);
        System.out.println("s1地址：0x"+Integer.toHexString(System.identityHashCode(s1)));
        System.out.println("s2地址：0x"+Integer.toHexString(System.identityHashCode(s2)));

    }
    public static void main1(String[] args) {
        String str = "abcdefg";
        String ret = str.substring(3);
        System.out.println(ret);
        String ret2 = str.substring(1,4);
        System.out.println(ret2);
    }
}